package han.yang.service.user.controller;

import han.yang.common.ResponseVO;
import han.yang.service.user.model.req.DeleteUserReq;
import han.yang.service.user.model.req.ModifyUserInfoReq;
import han.yang.service.user.service.ImUserService;
import han.yang.service.user.model.req.GetUserInfoReq;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * @author yanghan
 * @date 2023/2/17
 */
@RestController
@RequestMapping("v1/user/data")
public class ImUserDataController {

    @Resource
    ImUserService imUserService;

    @RequestMapping("/getUserInfo")
    public ResponseVO<?> getUserInfo(@RequestBody @NotNull GetUserInfoReq req, Integer appId){
        req.setAppId(appId);
        return imUserService.getUserInfo(req);
    }

    @RequestMapping("/getSingleUserInfo/{userId}")
    public ResponseVO<?>  getSingleUserInfo(@PathVariable("userId") String userId){
        return imUserService.getSingleUserInfo(userId);
    }

    @RequestMapping("/deleteUser")
    public ResponseVO<?>  deleteUser(@RequestBody @NotNull DeleteUserReq req){
        return imUserService.deleteUser(req);
    }

    @RequestMapping("/modifyUserInfo")
    public ResponseVO<?>  modifyUserInfo(@RequestBody @NotNull ModifyUserInfoReq req){
        return imUserService.modifyUserInfo(req);
    }
}
